Moran’s I tells us if our data are globally clustered without indicating where exactly it is happening. We can learn about location of clusters and outliers by using local indicators of spatial association (LISA).
LISA
LISA analysis can be performed using localmoran function from spdep package.
SA2_IRSAD_s_lm <- localmoran(SA2_SEIFA_proj$IRSAD_s, listw = SA2_weights_queen_list)
We obtain an aobject of localmoran class that stores five results:
## Ii E.Ii Var.Ii
## Min. :-1.089355 Min. :-0.003289 Min. :0.07981
## 1st Qu.: 0.007243 1st Qu.:-0.003289 1st Qu.:0.13914
## Median : 0.251212 Median :-0.003289 Median :0.16287
## Mean : 0.586990 Mean :-0.003289 Mean :0.18720
## 3rd Qu.: 0.958551 3rd Qu.:-0.003289 3rd Qu.:0.19610
## Max. : 4.996230 Max. :-0.003289 Max. :0.49514
## Z.Ii Pr(z > 0)
## Min. :-2.45254 Min. :0.00000
## 1st Qu.: 0.02124 1st Qu.:0.01074
## Median : 0.60875 Median :0.27134
## Mean : 1.44160 Mean :0.28056
## 3rd Qu.: 2.29933 3rd Qu.:0.49153
## Max. :15.24860 Max. :0.99291
Where values indicate:
Ii - local moran statistic E.Ii - expectation of local moran statistic Var.Ii - variance of local moran statistic Z.Ii - standard deviate of local moran statistic Pr() - p-value of local moran statistic
We can extract values of significane test fromthe fifth column of results.
SA2_SEIFA_proj$IRSAD_s_lmsig <- SA2_IRSAD_s_lm[, 5] <= 0.05
First we create a variable with four classes depending on which quadrant the region lies on the scaterplot of standardized versus lagged values.
SA2_SEIFA_proj$quad <- NA
SA2_SEIFA_proj@data[SA2_SEIFA_proj$IRSAD_s_std > 0 & SA2_SEIFA_proj$IRSAD_s_lag > 0, "quad"] <- 1
SA2_SEIFA_proj@data[SA2_SEIFA_proj$IRSAD_s_std < 0 & SA2_SEIFA_proj$IRSAD_s_lag < 0, "quad"] <- 2
SA2_SEIFA_proj@data[SA2_SEIFA_proj$IRSAD_s_std > 0 & SA2_SEIFA_proj$IRSAD_s_lag < 0, "quad"] <- 3
SA2_SEIFA_proj@data[SA2_SEIFA_proj$IRSAD_s_std < 0 & SA2_SEIFA_proj$IRSAD_s_lag > 0, "quad"] <- 4
We can repeat the step additionally marking results significant depending on p-value obtained from the localmoran test.
SA2_SEIFA_proj$quad_sig <- NA
SA2_SEIFA_proj@data[(SA2_SEIFA_proj$IRSAD_s_std > 0 & SA2_SEIFA_proj$IRSAD_s_lag > 0) & (SA2_IRSAD_s_lm[, 5] < 0.05), "quad_sig"] <- 1
SA2_SEIFA_proj@data[(SA2_SEIFA_proj$IRSAD_s_std < 0 & SA2_SEIFA_proj$IRSAD_s_lag < 0) & (SA2_IRSAD_s_lm[, 5] < 0.05), "quad_sig"] <- 2
SA2_SEIFA_proj@data[(SA2_SEIFA_proj$IRSAD_s_std > 0 & SA2_SEIFA_proj$IRSAD_s_lag < 0) & (SA2_IRSAD_s_lm[, 5] < 0.05), "quad_sig"] <- 3
SA2_SEIFA_proj@data[(SA2_SEIFA_proj$IRSAD_s_std < 0 & SA2_SEIFA_proj$IRSAD_s_lag > 0) & (SA2_IRSAD_s_lm[, 5] < 0.05), "quad_sig"] <- 4
SA2_SEIFA_proj@data[SA2_IRSAD_s_lm[, 5] >= 0.05, "quad_sig"] <- 5
Now we are ready to map our results. Each value belongs to one quadrant
##
## # x <numeric>
## # total N=305 valid N=305 mean=1.93 sd=0.97
##
## val frq raw.prc valid.prc cum.prc
## 1 125 40.98 40.98 40.98
## 2 106 34.75 34.75 75.74
## 3 45 14.75 14.75 90.49
## 4 29 9.51 9.51 100.00
## <NA> 0 0.00 NA NA
We can map it into four categories.
tm_shape(SA2_SEIFA_proj) +
tm_fill(col = "quad", alpha = 0.5, style = "cat",
palette = c("red", "blue", "lightpink", "skyblue2"),
labels = c("High-High", "Low-Low", "High-Low", "Low-High"),
title = "Local Moran's I")
Taking itnto account significance of results, we can add one morecategory to the results for regions that are not significantly different according to permutation test:
frq(SA2_SEIFA_proj$quad_sig)
##
## # x <numeric>
## # total N=305 valid N=305 mean=3.87 sd=1.67
##
## val frq raw.prc valid.prc cum.prc
## 1 51 16.72 16.72 16.72
## 2 47 15.41 15.41 32.13
## 5 207 67.87 67.87 100.00
## <NA> 0 0.00 NA NA
Since we only have first and second category, we modify our palette and labels arguments and also add white colour for insignificat results:
tm_shape(SA2_SEIFA_proj) +
tm_fill(col = "quad_sig", alpha = 0.5, style = "cat",
# palette = c("red", "blue", "lightpink", "skyblue2", "white"),
# labels = c("High-High", "Low-Low", "High-Low", "Low-High", "Not Signif."),
palette = c("red", "blue", NA),
labels = c("High-High", "Low-Low", "Not Signif."),
title = "Local Moran's I")
How does that map compare to original map of IRSAD score and deciles?